// #################################################################
//
// AUTHOR: Nick LaPrell (Nick@LaPrell.org)
// PROJECT HOME: http://code.google.com/p/pluginloader/
// LICENSE: MIT - http://www.opensource.org/licenses/mit-license.php  
//
// #################################################################
 
 jqPlugins = new Object();
 
(function($){
  
	// Default options
	dOptions = {
		path : '/js/jQueryPlugins/',
		async : false
	}

	$.loadPlugins = function(plugins,options) {
		var o = typeof options != 'undefined' ? $.extend(dOptions, options) : dOptions;
		var list = [];
		if(plugins instanceof Array === false){list[0] = plugins;}else{list = plugins;}
	    for(var i in list){
			if (typeof jqPlugins[i] == 'undefined') {
				var plugin = o.path + "jquery." + list[i] + ".js";
				$.ajax({
					url: plugin,
					dataType: 'script',
					async: o.async
				});
			}
	    }
	}
})(jQuery);
